<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title></title>
    <link rel="stylesheet" href="{$Assets}layui/css/layui.css">
    <style type="text/css">
.layui-table-body{
    overflow: hidden;
}
    </style>
</head>
<body>



<div style="width: 94%;margin:0 auto;">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
  <legend>权限设置</legend>
</fieldset>
  <form class="layui-form layui-form-pane" action="">
      <input type="hidden" name="id" value="{$info.id}">
      <div class="layui-form-item">
        <label class="layui-form-label">产品</label>
        <div class="layui-input-block">
          <input type="checkbox" name="0" lay-skin="primary" title="产品管理" {if condition="$info.power.0 == '1'"} checked=""{/if}>
          <input type="checkbox" name="1" lay-skin="primary" title="栏目管理" {if condition="$info.power.1 == '1'"} checked=""{/if}>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">卡劵</label>
        <div class="layui-input-block">
          <input type="checkbox" name="2" lay-skin="primary" title="代金卷" {if condition="$info.power.2 == '1'"} checked=""{/if}>
          <input type="checkbox" name="3" lay-skin="primary" title="礼品卷" {if condition="$info.power.3 == '1'"} checked=""{/if}>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">积分</label>
        <div class="layui-input-block">
          <input type="checkbox" name="4" lay-skin="primary" title="积分商品" {if condition="$info.power.4 == '1'"} checked=""{/if}>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">订单</label>
        <div class="layui-input-block">
          <input type="checkbox" name="5" lay-skin="primary" title="订单管理" {if condition="$info.power.5 == '1'"} checked=""{/if}>
          <input type="checkbox" name="6" lay-skin="primary" title="订单核销" {if condition="$info.power.6 == '1'"} checked=""{/if}>
          <input type="checkbox" name="11" lay-skin="primary" title="已核销订单" {if condition="$info.power.11 == '1'"} checked=""{/if}>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">会员</label>
        <div class="layui-input-block">
          <input type="checkbox" name="7" lay-skin="primary" title="会员积分" {if condition="$info.power.7 == '1'"} checked=""{/if}>
          <input type="checkbox" name="8" lay-skin="primary" title="管理员" {if condition="$info.power.8 == '1'"} checked=""{/if}>
          <input type="checkbox" name="9" lay-skin="primary" title="权限设置" {if condition="$info.power.9 == '1'"} checked=""{/if}>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">基础设置</label>
        <div class="layui-input-block">
          <input type="checkbox" name="10" lay-skin="primary" title="基础设置" {if condition="$info.power.10 == '1'"} checked=""{/if}>
        </div>
      </div>

      <div class="layui-form-item">
        <button class="layui-btn" lay-submit="" lay-filter="demo2">提交</button>
      </div>


  </form>
</div>













<script src="{$Assets}layui/layui.js?t=1515376178709"></script>
<script>
layui.use(['form', 'layedit', 'laydate'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,$ = layui.jquery
  ,layedit = layui.layedit
  ,laydate = layui.laydate;


  
  //监听提交
  form.on('submit(demo2)', function(data){
        power=JSON.stringify(data.field);
        var iframe = parent.layer.getFrameIndex(window.name);
                  $.ajax({
                        type:"POST",
                        url: "{:url('user/set_power_save')}",
                        data:{data:power},
                        dataType:"json",

                        success:function(ret_datas){
                            if(ret_datas==1){
                                layer.msg('设置成功!');
                            }else if(ret_datas==99){
                                layer.msg('设置异常！');
                            }else{
                                layer.msg(ret_datas);
                            }
                            setTimeout(function(){
                              parent.layer.close(iframe);
                            },"1000");
                        }
                  });
        return false;
  });

  
});
</script>

</body>
</html>